<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>选择号码</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="/zhenze/Public/home/css/reset.css"/>
		<link rel="stylesheet" href="/zhenze/Public/home/css/xuanzehaoma.css" />
		<link rel="stylesheet" href="/zhenze/Public/home/css/font-awesome.min.css" />
	</head>
	<body>
		<div class="ll">
			<div class="top">
				<a href="javascript:history.go(-1);"><i class="fa fa-angle-left"></i></a>
				<p>选择号码</p>
			</div>
			<form name="myform" id="myform" action="<?php echo U('index/choosetel',array('setmeal_id'=>$setmealinfo['set_id']));?>" method="post">
			<div class="search">
				<input type="text" name="keyword" id="keyword" placeholder="搜索" value="<?php echo ($keyword); ?>" datatype="*" errormsg="请输入关键字！" maxlength="10"  />
				<i class="fa fa-search" onclick="javascript:$('#myform').submit();"></i>
			</div>
			</form>
			<div style="width: 16.75rem;margin: 0 auto;height: 0.025rem;background: #d2d2d2;"></div>
			<div class="cont">
				<img src="/zhenze/Public/home/img/true02.png" />
				<p>已选择：<?php echo ($setmealinfo["set_title"]); ?></p>
			</div>
			<div class="cont1">
				<p>选择号码</p>
				<select name="topthree" id="topthree" onchange="topthree_search(this.value);">
					<option value="">请选择</option>
					<?php if(is_array($setting)): $i = 0; $__LIST__ = $setting;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($data); ?>"<?php if($topthree == $data): ?>selected<?php endif; ?>><?php echo ($data); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
				</select>
			</div>
			<input id="new_mobile" name="new_mobile" type="hidden" value="" readonly>
		</div>
		<div style="height: 9rem;" id="top"></div>
		<div class="containter">
			<ul id="gundong">
				<?php if(is_array($listinfo)): $i = 0; $__LIST__ = $listinfo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><li data="<?php echo ($data["tel_number"]); ?>"><p><?php echo ($data["tel_number"]); ?></p><img src="/zhenze/Public/home/img/false03.png"/></li><?php endforeach; endif; else: echo "" ;endif; ?>
				<div class="clear"></div>
			</ul>
			<button onclick="getmore()" id="morebtn" data='1' class="btn00">更多</button>
			<div class="clear" style="height: 3rem;"></div>
		</div>
		<div class="btnBg">
			<button onclick="javascript:nextstep();">下一步</button>
		</div>
		<div class="fanhui">
			<a href="#top">
				<img src="/zhenze/Public/home/img/fanhui.png" />
				<p>顶部</p>
			</a>
		</div>
		<script src="/zhenze/Public/home/js/screenSize.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="/zhenze/Public/home/js/jquery-3.1.1.min.js" ></script>

		<link href="/zhenze/Public/validform/Validform.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="/zhenze/Public/validform/Validform_v5.3.2.js"></script>
		<script type="text/javascript" src="/zhenze/Public/validform/Validform_Datatype.js"></script>
		<script>
		$(function(){
			var windowTop=0;
			$(window).scroll(function() {
				var scrolls = $(this).scrollTop();
				if(scrolls>=windowTop){
					$('.fanhui').css("display","block")
					windowTop=scrolls;
				}else{
					$('.fanhui').css("display","none")
					windowTop=scrolls;
				}
			});

			$("#myform").Validform({
				tiptype:1
			});
		})
		</script>
		<script>
		$(function(){
			$('.containter ul li img').click(function(){ 
				$(this).attr("src","/zhenze/Public/home/img/true02.png");
				$('.containter ul li img').not(this).attr("src","/zhenze/Public/home/img/false03.png");
				var new_mobile=$(this).parents("li").attr("data");
				$("#new_mobile").val(new_mobile);
			})
		})
		//号码前三位
		function topthree_search(v){
			if(v.length>0){
				var keyword=$("#keyword").val();
				if(keyword.length>0){
					location.href="<?php echo U('index/choosetel',array('setmeal_id'=>$setmealinfo['set_id']));?>&keyword="+keyword+"&topthree="+v;
				}else{
					location.href="<?php echo U('index/choosetel',array('setmeal_id'=>$setmealinfo['set_id']));?>&topthree="+v;
				}
			}
		}
		//下一步
		function nextstep(){
			var new_mobile=$("#new_mobile").val();
			var setmeal_id=<?php echo ($setmealinfo["set_id"]); ?>;
			if(new_mobile.length>0){
				location.href="<?php echo U('index/fillinfo');?>&new_mobile="+new_mobile+"&setmeal_id="+setmeal_id;
			}else{
				alert("请选择号码后再进行下一步预约");
			}
		}
		</script>
		<script>
		function getmore(){			
			var page=parseInt($('#morebtn').attr("data"))+1;
			var keyword=$("#keyword").val();
			var topthree=$("#topthree").val();
		
			$.getJSON("<?php echo U('index/choosetel',array('setmeal_id'=>$setmealinfo['set_id']));?>&keyword="+keyword+"&topthree="+topthree+"&p="+page,function(result){
				$('#morebtn').attr("data",page);//重置当前页数
				var data=result.listinfo;
				if(data.length>0){
					var html="";
					for(var i=0;i<data.length;i++){
						html+="<li data='"+data[i].tel_number+"'><p>"+data[i].tel_number+"</p><img src='/zhenze/Public/home/img/false03.png'/></li>";
					}
					$("#gundong div").before(html);
					//重新绑定点击事件
					$('.containter ul li img').click(function(){ 
						$(this).attr("src","/zhenze/Public/home/img/true02.png");
						$('.containter ul li img').not(this).attr("src","/zhenze/Public/home/img/false03.png");
						var new_mobile=$(this).parents("li").attr("data");
						$("#new_mobile").val(new_mobile);
					})
				}else{
					$("#morebtn").html('亲，没有数据了！');
				}
			});
		}
		</script>
	</body>
</html>